package com.creditcmsplt.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 * 数据库操作DAO：creditauoth表 厂商授权表
 * 
 * @author 雷阳军
 *
 */
public interface CreditApiMapper {

	@Insert("INSERT INTO t_credit_api(user_id, vendor_key,vendor_secret,apiurl,status,created_at,updated_at) " + 
			"select user_id,vendor_key,vendor_secret,#{apiurl},#{status},NOW(),NOW() from t_credit_auoth where vendor_key=#{vendor_key} and vendor_secret=#{vendor_secret}")
	public void insertByKey(@Param("vendor_key") String vendor_key,@Param("vendor_secret") String vendor_secret,@Param("apiurl") String apiurl,@Param("status") Integer status);
	
	@Insert("INSERT INTO t_credit_api(user_id, vendor_key,vendor_secret,apiurl,status,created_at,updated_at) " + 
			"select user_id,vendor_key,vendor_secret,#{apiurl},#{status},NOW(),NOW() from t_credit_auoth where token=#{token}")
	public void insertByToken(@Param("token") String token,@Param("apiurl") String apiurl,@Param("status") Integer status);
	
}
